<template>
  <el-container direction="vertical">

    <navMenu width="100%"></navMenu>

    <el-container direction="horizontal">
      <el-aside width="280px">
        <sideBar class="menu"></sideBar>
      </el-aside>
      <el-main>
        <el-form label-position="left" label-width="0px" class="login-form">
          <el-form-item prop="old_pass">
            <el-input v-model="exam.UserName" type="text"  placeholder="登录名称" >
              <svg-icon slot="prefix"  class="el-input__icon input-icon" />
            </el-input>
          </el-form-item>
          <el-form-item prop="new_pass">
            <el-input v-model="exam.REAL_NAME" type="text"  placeholder="用户名" >
              <svg-icon slot="prefix"  class="el-input__icon input-icon" />
            </el-input>
          </el-form-item>
          <el-form-item prop="conf_pass">
            <el-input v-model="exam.theme" type="text"  placeholder="页面风格" >
              <svg-icon slot="prefix"  class="el-input__icon input-icon" />
            </el-input>
          </el-form-item>
          <el-form-item prop="conf_pass">
            <el-input v-model="exam.EMAIL" type="text" auto-comple placeholder="邮箱" >
              <svg-icon slot="prefix"  class="el-input__icon input-icon" />
            </el-input>
          </el-form-item>
          <el-form-item style="width:100%;">
            <el-button :loading="loading" size="medium" type="primary" style="width:100%;" @click="updatePass()" >
              <span>确  认</span>
            </el-button>
          </el-form-item>
        </el-form>
      </el-main>
    </el-container>
  </el-container>

</template>

<script>
export default {
  data() {
    return {
      exam: {
        UserName: '',
        REAL_NAME: '',
        theme: '',
        EMAIL: ''
      }
    }
  },
  methods:{
    async updatePass() {
      this.$axios.post(`http://127.0.0.1:5000/update_info_admin`, this.exam).then((res)=>{
        console.log(res);
        if (res.data == 1) {
          alert("修改成功,点击确定返回首页。")
          this.$router.push({path:'/home'});
        }
        else if(res.data == 0){
          alert("修改失败")
        }
      });
    }
  }
}
</script>
